﻿
//  Copyright (c) Microsoft Corporation.  All Rights Reserved.

using System;
using System.Configuration;
using System.ServiceModel.Configuration;
using Sripirom.ATS.Core.Configuration;
using Sripirom.ATS.Core.Logging;
using Sripirom.ATS.Core.Messaging;

namespace Sripirom.ATS.Core.ServiceModel.Description
{ 
    public class AtsServiceBehaviorExtensionElement : BehaviorExtensionElement
    {                                         
        public AtsServiceBehaviorExtensionElement()
        {
          //  Innit();                                    
        }
        //private void Innit()
        //{
        //    #region AppConfig setting
        //    AppSettingsFactory.InitializeApplicationSettingsFactory(new ServiceApplicationSettings());
        //    #endregion
        //    #region Logger setting
        //    LoggerFactory.SetCurrent(new Log4NetLogFactory(LoggerName));
        //    //log4net.ILog logger = LogManager.GetLogger();
        //    #endregion
        //}
        public override Type BehaviorType 
        { 
            get
            {
                return typeof(AtsServiceBehavior);
            } 
        }

        protected override object CreateBehavior()
        {

            ServiceBootStrapper.ConfigureDependencies(RegistiesBootStrapper);
            #region AppConfig setting
            AppSettingsFactory.InitializeApplicationSettingsFactory(new ServiceApplicationSettings());
            #endregion
            //#region Logger setting
     
            LoggerFactory.SetCurrent(new Log4NetLogFactory(LoggerName));
            //#endregion
           
            #region MessageOutput setting
            MessageOutputFactory.Innit(new MessageOutputdapter());
            #endregion

           
            //var controllerFactory = new WindsorControllerFactory(container.Kernel);
            //ControllerBuilder.Current.SetControllerFactory(controllerFactory);

           


            LoggerFactory.CreateLog().Debug("Create ServiceOperationBehavior.");
            #if DEBUG
            foreach (var item in ServiceCommands)
            {
                LoggerFactory.CreateLog().Debug("OperationElement " + ((ServiceCommandConfigElement)item).OperationService);
            }
            #endif

            return new AtsServiceBehavior(ServiceCommands);
        }

        [ConfigurationProperty("loggerName", DefaultValue = "SGWLogger", IsRequired = false)]
        public string LoggerName
        {
            get { return (string)base["loggerName"]; } 
            set { base["loggerName"] = value; }
        }

        //Declare the Schema collection property.
        //Note: the "IsDefaultCollection = false" instructs 
        //.NET Framework to build a nested section of 
        //the kind <Schema> ...</Schema>.
        [ConfigurationProperty("operationInvokers", IsDefaultCollection = true)]
        [ConfigurationCollection(typeof(ServiceCommandsCollection),
            AddItemName = "operation",
            ClearItemsName = "clear",
            RemoveItemName = "remove")]
        public ServiceCommandsCollection ServiceCommands
        {
            get
            {
                ServiceCommandsCollection serviceCommandsCollection = (ServiceCommandsCollection)base["operationInvokers"];
                return serviceCommandsCollection;
            }
        }

        //Declare the Schema collection property.
        //Note: the "IsDefaultCollection = false" instructs 
        //.NET Framework to build a nested section of 
        //the kind <Schema> ...</Schema>.
        [ConfigurationProperty("registryBootStrapper", IsDefaultCollection = true)]
        [ConfigurationCollection(typeof(RegistryCollection),
            AddItemName = "for",
            ClearItemsName = "clear",
            RemoveItemName = "remove")]
        public RegistryCollection RegistiesBootStrapper
        {                                      
            get                                 
            {
                RegistryCollection registryBootStrapper = (RegistryCollection)base["registryBootStrapper"];
                return registryBootStrapper;
            }
        }

    }

    #region ==== Define the ServiceCommandsCollection that will contain the ServiceCommandConfigElement ======

    public class ServiceCommandsCollection : ConfigurationElementCollection
    {
        public ServiceCommandsCollection()
        {
            
        }

        public override ConfigurationElementCollectionType CollectionType
        {
            get
            {
                return ConfigurationElementCollectionType.AddRemoveClearMap;
            }
        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new ServiceCommandConfigElement();
        }

        protected override Object GetElementKey(ConfigurationElement element)
        {
            return ((ServiceCommandConfigElement)element).OperationService;
        }

        public ServiceCommandConfigElement this[int index]
        {
            get
            {
                return (ServiceCommandConfigElement)BaseGet(index);
            }
            set
            {
                if (BaseGet(index) != null)
                {
                    BaseRemoveAt(index);
                }
                BaseAdd(index, value);
            }
        }

        new public ServiceCommandConfigElement this[string Name]
        {
            get
            {
                return (ServiceCommandConfigElement)BaseGet(Name);
            }
        }

        public int IndexOf(ServiceCommandConfigElement Schema)
        {
            return BaseIndexOf(Schema);
        }

        public void Add(ServiceCommandConfigElement Schema)
        {
            BaseAdd(Schema);
        }
        protected override void BaseAdd(ConfigurationElement element)
        {
            BaseAdd(element, false);
        }

        public void Remove(ServiceCommandConfigElement Schema)
        {
            if (BaseIndexOf(Schema) >= 0)
                BaseRemove(Schema.OperationService);
        }

        public void RemoveAt(int index)
        {
            BaseRemoveAt(index);
        }

        public void Remove(string name)
        {
            BaseRemove(name);
        }

        public void Clear()
        {
            BaseClear();
        }
    }

    public class ServiceCommandConfigElement : ConfigurationElement
    {
        public ServiceCommandConfigElement(String operationService)
        {
            this.OperationService = operationService;
        }

        public ServiceCommandConfigElement()
        {
        }

        /// <summary>
        /// FullyQualifiedName
        /// </summary>
        [ConfigurationProperty("name", DefaultValue = null, IsRequired = false, IsKey = false)]
        public string Name
        {
            get  { return (string)this["name"]; }
            set { this["name"] = value; }
        }

        [ConfigurationProperty("sysId", DefaultValue = null, IsRequired = false, IsKey = false)]
        public string SysId
        {
            get { return (string)this["sysId"]; }
            set { this["sysId"] = value; }
        }

        [ConfigurationProperty("serviceDesc", DefaultValue = null, IsRequired = false, IsKey = false)]
        public string ServiceDesc
        {
            get { return (string)this["serviceDesc"]; }
            set { this["serviceDesc"] = value; }
        }

        [ConfigurationProperty("serviceEffectiveDate", DefaultValue = null, IsRequired = false, IsKey = false)]
        public string ServiceEffectiveDate
        {
            get { return (string)this["serviceEffectiveDate"]; }
            set { this["serviceEffectiveDate"] = value; }
        }

        [ConfigurationProperty("serviceStartTime", DefaultValue = null, IsRequired = false, IsKey = false)]
        public string ServiceStartTime
        {
            get { return (string)this["serviceStartTime"]; }
            set { this["serviceStartTime"] = value; }
        }
        [ConfigurationProperty("serviceEndTime", DefaultValue = null, IsRequired = false, IsKey = false)]
        public string ServiceEndTime
        { 
            get { return (string)this["serviceEndTime"]; }
            set { this["serviceEndTime"] = value; }
        }
        [ConfigurationProperty("activeFlag", DefaultValue = true, IsRequired = false, IsKey = false)]
        public bool ActiveFlag
        {
            get { return (bool)this["activeFlag"]; }
            set { this["activeFlag"] = value; }
        }
        [ConfigurationProperty("operationService", DefaultValue = null, IsRequired = true, IsKey = false)]
        public string OperationService
        {
            get { return (string)this["operationService"]; }
            set { this["operationService"] = value; }
        }

        [ConfigurationProperty("messageValidate", DefaultValue = null, IsRequired = true, IsKey = false)]
        public MessageValidateConfigElement MessageValidate
        {
            get { return (MessageValidateConfigElement)this["messageValidate"]; }
            set { this["messageValidate"] = value; }
        }

        //Declare the Schema collection property.
        //Note: the "IsDefaultCollection = false" instructs 
        //.NET Framework to build a nested section of 
        //the kind <Schema> ...</Schema>.
        //[ConfigurationProperty("channels", IsDefaultCollection = true)]
        //[ConfigurationCollection(typeof(ChannelsCollection),
        //    AddItemName = "channel",
        //    ClearItemsName = "clear",
        //    RemoveItemName = "remove")]
        //public ChannelsCollection Channels
        //{
        //    get
        //    { 
        //        ChannelsCollection channelsCollection = (ChannelsCollection)base["channels"];
        //        return channelsCollection;
        //    }
        //}

    }

    #endregion ================================================================================================

    #region ==== MessageValidate Config ========================================================================
    public class MessageValidateConfigElement : ConfigurationElement
    {
        public MessageValidateConfigElement()
        {

        }

        [ConfigurationProperty("name", DefaultValue = null, IsRequired = true, IsKey = true)]
        public string Name
        {
            get { return (string)this["name"]; }
            set { this["name"] = value; }
        }

        //Declare the Schema collection property.
        //Note: the "IsDefaultCollection = false" instructs 
        //.NET Framework to build a nested section of 
        //the kind <Schema> ...</Schema>.
        //[ConfigurationProperty("Validator", IsDefaultCollection = true)]
        //[ConfigurationCollection(typeof(ValidatorCollection),
        //    AddItemName = "add",
        //    ClearItemsName = "clear",
        //    RemoveItemName = "remove")]
        //public ValidatorCollection Validator
        //{
        //    get 
        //    {
        //        ValidatorCollection ValidatorCollection = (ValidatorCollection)base["Validator"];
        //        return ValidatorCollection;
        //    }
        //}

        //Declare the Schema collection property.
        //Note: the "IsDefaultCollection = false" instructs 
        //.NET Framework to build a nested section of 
        //the kind <Schema> ...</Schema>.
        [ConfigurationProperty("headerValidates", IsDefaultCollection = true)]
        [ConfigurationCollection(typeof(PropertiesCollection),
            AddItemName = "property",
            ClearItemsName = "clear",
            RemoveItemName = "remove")]
        public PropertiesCollection HeaderValidates
        {
            get
            {
                PropertiesCollection headerValidatesCollection = (PropertiesCollection)base["headerValidates"];
                return headerValidatesCollection;
            }
        }

        //Declare the Schema collection property.
        //Note: the "IsDefaultCollection = false" instructs 
        //.NET Framework to build a nested section of 
        //the kind <Schema> ...</Schema>.
        [ConfigurationProperty("bodyValidates", IsDefaultCollection = true)]
        [ConfigurationCollection(typeof(PropertiesCollection),
            AddItemName = "property",
            ClearItemsName = "clear",
            RemoveItemName = "remove")]
        public PropertiesCollection BodyValidates
        {
            get
            {
                PropertiesCollection bodyValidatesCollection = (PropertiesCollection)base["bodyValidates"];
                return bodyValidatesCollection;
            }
        }

    }

    #endregion =================================================================================================

    #region ==== Validator Config ========================================================================
    /// <summary>
    /// 
    /// </summary>
    public class ValidatorCollection : ConfigurationElementCollection
    {
        private static readonly ConfigurationPropertyCollection _properties;
        static ValidatorCollection()
        {
            _properties = new ConfigurationPropertyCollection();
        }

        protected override ConfigurationPropertyCollection Properties
        {
            get
            {
                return _properties;
            }
        }

        public override ConfigurationElementCollectionType CollectionType
        {
            get { return ConfigurationElementCollectionType.AddRemoveClearMap; }
        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new ObjectValidateConfigElement();
        }

        protected override Object GetElementKey(ConfigurationElement element)
        {
            return ((ObjectValidateConfigElement)element).Name;
        }

        public ObjectValidateConfigElement this[int index]
        {
            get
            {
                return (ObjectValidateConfigElement)BaseGet(index);
            }
            set
            {
                if (BaseGet(index) != null)
                {
                    BaseRemoveAt(index);
                }
                BaseAdd(index, value);
            }
        }

        new public ObjectValidateConfigElement this[string Name]
        {
            get
            {
                return (ObjectValidateConfigElement)BaseGet(Name);
            }
        }

        public int IndexOf(ObjectValidateConfigElement Schema)
        {
            return BaseIndexOf(Schema);
        }

        public void Add(ObjectValidateConfigElement Schema)
        {
            BaseAdd(Schema);
        }
        protected override void BaseAdd(ConfigurationElement element)
        {
            BaseAdd(element, false);
        }

        public void Remove(ObjectValidateConfigElement Schema)
        {
            if (BaseIndexOf(Schema) >= 0)
                BaseRemove(Schema.Name);
        }

        public void RemoveAt(int index)
        {
            BaseRemoveAt(index);
        }

        public void Remove(string code)
        {
            BaseRemove(code);
        }

        public void Clear()
        {
            BaseClear();
        }
    }

    public class ObjectValidateConfigElement : ConfigurationElement
    {

        public ObjectValidateConfigElement()
        {
        }

        [ConfigurationProperty("name", DefaultValue = null, IsRequired = true, IsKey = true)]
        public string Name
        {
            get { return (string)this["name"]; }
            set { this["name"] = value; }
        }

    }

    #endregion


    #region ==== Properties Validate Config ========================================================================
    /// <summary>
    /// 
    /// </summary>
    public class PropertiesCollection : ConfigurationElementCollection
    {
        private static readonly ConfigurationPropertyCollection _properties;
        static PropertiesCollection()
        {
            _properties = new ConfigurationPropertyCollection();
        }

        protected override ConfigurationPropertyCollection Properties
        {
            get
            {
                return _properties;
            }
        }

        public override ConfigurationElementCollectionType CollectionType
        {
            get { return ConfigurationElementCollectionType.AddRemoveClearMap; }
        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new PropertyConfigElement();
        }

        protected override Object GetElementKey(ConfigurationElement element)
        {
            return ((PropertyConfigElement)element).FieldName;
        }

        public PropertyConfigElement this[int index]
        {
            get
            {
                return (PropertyConfigElement)BaseGet(index);
            }
            set
            {
                if (BaseGet(index) != null)
                {
                    BaseRemoveAt(index);
                }
                BaseAdd(index, value);
            }
        }

        new public PropertyConfigElement this[string Name]
        {
            get
            {
                return (PropertyConfigElement)BaseGet(Name);
            }
        }

        public int IndexOf(PropertyConfigElement Schema)
        {
            return BaseIndexOf(Schema);
        }

        public void Add(PropertyConfigElement Schema)
        {
            BaseAdd(Schema);
        }
        protected override void BaseAdd(ConfigurationElement element)
        {
            BaseAdd(element, false);
        }

        public void Remove(PropertyConfigElement Schema)
        {
            if (BaseIndexOf(Schema) >= 0)
                BaseRemove(Schema.FieldName);
        }

        public void RemoveAt(int index)
        {
            BaseRemoveAt(index);
        }

        public void Remove(string code)
        {
            BaseRemove(code);
        }

        public void Clear()
        {
            BaseClear();
        }
    }

    public class PropertyConfigElement : ConfigurationElement
    {

        public PropertyConfigElement()
        {
        }

        [ConfigurationProperty("fieldName", DefaultValue = null, IsRequired = true, IsKey = true)]
        public string FieldName
        {
            get { return (string)this["fieldName"]; }
            set { this["fieldName"] = value; }
        }

        [ConfigurationProperty("isMandatory", DefaultValue = null, IsRequired = true, IsKey = false)]
        public bool IsMandatory
        {
            get { return (bool)this["isMandatory"]; }
            set { this["isMandatory"] = value; }
        }

        [ConfigurationProperty("messageType", DefaultValue = null, IsRequired = true, IsKey = false)]
        public string MessageType
        { 
            get { return (string)this["messageType"]; }
            set { this["messageType"] = value; }
        }

        [ConfigurationProperty("possibleValues", DefaultValue = "", IsRequired = false, IsKey = false)]
        public string PossibleValues
        { 
            get { return (string)this["possibleValues"]; }
            set { this["possibleValues"] = value; }
        }

        [ConfigurationProperty("minLen", DefaultValue = null, IsRequired = false, IsKey = false)]
        public int MinLen
        {
            get { return (int)this["minLen"]; }
            set { this["minLen"] = value; }
        }
        [ConfigurationProperty("maxLen", DefaultValue = null, IsRequired = false, IsKey = false)]
        public int MaxLen
        { 
            get { return (int)this["maxLen"]; }
            set { this["maxLen"] = value; }
        }

        [ConfigurationProperty("scale", DefaultValue = null, IsRequired = false, IsKey = false)]
        public int Scale
        {
            get { return (int)this["scale"]; }
            set { this["scale"] = value; }
        }

        [ConfigurationProperty("precision", DefaultValue = null, IsRequired = false, IsKey = false)]
        public int Precision
        {
            get { return (int)this["precision"]; }
            set { this["precision"] = value; }
        }

    }

    #endregion

    #region ==== Channel Config ========================================================================

    public class ChannelsCollection : ConfigurationElementCollection
    {
        public ChannelsCollection()
        {

        }

        public override ConfigurationElementCollectionType CollectionType
        {
            get { return ConfigurationElementCollectionType.AddRemoveClearMap; }
        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new ChannelConfigElement();
        }

        protected override Object GetElementKey(ConfigurationElement element)
        {
            return ((ChannelConfigElement)element).Code;
        }

        public ChannelConfigElement this[int index]
        {
            get
            {
                return (ChannelConfigElement)BaseGet(index);
            }
            set
            {
                if (BaseGet(index) != null)
                {
                    BaseRemoveAt(index);
                }
                BaseAdd(index, value);
            }
        }

        new public ChannelConfigElement this[string Name]
        {
            get
            {
                return (ChannelConfigElement)BaseGet(Name);
            }
        }

        public int IndexOf(ChannelConfigElement Schema)
        {
            return BaseIndexOf(Schema);
        }

        public void Add(ChannelConfigElement Schema)
        {
            BaseAdd(Schema);
        }
        protected override void BaseAdd(ConfigurationElement element)
        {
            BaseAdd(element, false);
        }

        public void Remove(ChannelConfigElement Schema)
        {
            if (BaseIndexOf(Schema) >= 0)
                BaseRemove(Schema.Code);
        }

        public void RemoveAt(int index)
        {
            BaseRemoveAt(index);
        }

        public void Remove(string code)
        {
            BaseRemove(code);
        }

        public void Clear()
        {
            BaseClear();
        }
    }

    public class ChannelConfigElement : ConfigurationElement
    {

        public ChannelConfigElement()
        {
        }

        [ConfigurationProperty("code", DefaultValue = null, IsRequired = true, IsKey = false)]
        public string Code
        {
            get { return (string)this["code"]; }
            set { this["code"] = value; }
        }

        [ConfigurationProperty("sysId", DefaultValue = null, IsRequired = true, IsKey = false)]
        public string SysId
        {
            get { return (string)this["sysId"]; }
            set { this["sysId"] = value; }
        }

      
        [ConfigurationProperty("activeFlag", DefaultValue = true, IsRequired = true, IsKey = false)]
        public bool ActiveFlag
        {
            get { return (bool)this["activeFlag"]; }
            set { this["activeFlag"] = value; }
        }


        //Declare the Schema collection property.
        //Note: the "IsDefaultCollection = false" instructs 
        //.NET Framework to build a nested section of 
        //the kind <Schema> ...</Schema>.
        [ConfigurationProperty("transferTypds", IsDefaultCollection = true)]
        [ConfigurationCollection(typeof(TransferTypesCollection),
            AddItemName = "add",
            ClearItemsName = "clear",
            RemoveItemName = "remove")]
        public TransferTypesCollection TransferTypes
        {
            get
            {
                TransferTypesCollection transferTypesCollection = (TransferTypesCollection)base["transferTypds"];
                return transferTypesCollection;
            }
        }

    }

    #endregion

    #region ==== TransferType Config ========================================================================

    public class TransferTypesCollection : ConfigurationElementCollection
    {
        public TransferTypesCollection()
        {

        }

        public override ConfigurationElementCollectionType CollectionType
        {
            get { return ConfigurationElementCollectionType.AddRemoveClearMap; }
        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new TransferTypeConfigElement();
        }

        protected override Object GetElementKey(ConfigurationElement element)
        {
            return ((TransferTypeConfigElement)element).TransferType;
        }

        public TransferTypeConfigElement this[int index]
        {
            get
            {
                return (TransferTypeConfigElement)BaseGet(index);
            }
            set
            {
                if (BaseGet(index) != null)
                {
                    BaseRemoveAt(index);
                }
                BaseAdd(index, value);
            }
        }

        new public TransferTypeConfigElement this[string Name]
        {
            get
            {
                return (TransferTypeConfigElement)BaseGet(Name);
            }
        }

        public int IndexOf(TransferTypeConfigElement Schema)
        {
            return BaseIndexOf(Schema);
        }

        public void Add(TransferTypeConfigElement Schema)
        {
            BaseAdd(Schema);
        }
        protected override void BaseAdd(ConfigurationElement element)
        {
            BaseAdd(element, false);
        }

        public void Remove(TransferTypeConfigElement Schema)
        {
            if (BaseIndexOf(Schema) >= 0)
                BaseRemove(Schema.TransferType);
        }

        public void RemoveAt(int index)
        {
            BaseRemoveAt(index);
        }

        public void Remove(string code)
        {
            BaseRemove(code);
        }

        public void Clear()
        {
            BaseClear();
        }
    }

    public class TransferTypeConfigElement : ConfigurationElement
    {

        public TransferTypeConfigElement()
        {
        }

        [ConfigurationProperty("transferType", DefaultValue = null, IsRequired = true, IsKey = false)]
        public string TransferType
        {
            get { return (string)this["transferType"]; }
            set { this["transferType"] = value; }
        }

        [ConfigurationProperty("transferDesc", DefaultValue = null, IsRequired = true, IsKey = false)]
        public string TransferDesc
        { 
            get { return (string)this["transferDesc"]; }
            set { this["transferDesc"] = value; }
        }

        [ConfigurationProperty("serviceStartTime", DefaultValue = null, IsRequired = true, IsKey = false)]
        public string ServiceStartTime
        {
            get { return (string)this["serviceStartTime"]; }
            set { this["serviceStartTime"] = value; }
        }
        [ConfigurationProperty("serviceEndTime", DefaultValue = null, IsRequired = true, IsKey = false)]
        public string ServiceEndTime
        {
            get { return (string)this["serviceEndTime"]; }
            set { this["serviceEndTime"] = value; }
        }
        [ConfigurationProperty("bankCode", DefaultValue = null, IsRequired = true, IsKey = false)]
        public string BankCode
        {
            get { return (string)this["bankCode"]; }
            set { this["bankCode"] = value; }
        }
        [ConfigurationProperty("branchCode", DefaultValue = null, IsRequired = true, IsKey = false)]
        public string BranchCode
        { 
            get { return (string)this["branchCode"]; }
            set { this["branchCode"] = value; }
        }

        [ConfigurationProperty("activeFlag", DefaultValue = true, IsRequired = true, IsKey = false)]
        public bool ActiveFlag
        {
            get { return (bool)this["activeFlag"]; }
            set { this["activeFlag"] = value; }
        }

    }

    #endregion



    #region StructureMap  argument
    public class RegistryElement : ConfigurationElement
    {
        public RegistryElement()
        {

        }

        public Type InterfaceType { get { return Type.GetType(Interface); } }
        public Type ImplementType { get { return Type.GetType(Implement); } }

        [ConfigurationProperty("interface", DefaultValue = null, IsRequired = true, IsKey = true)]
        public string Interface
        {
            get { return (string)this["interface"]; }
            set { this["interface"] = value; }
        }

        [ConfigurationProperty("implement", DefaultValue = null, IsRequired = true, IsKey = false)]
        public string Implement
        {
            get { return (string)this["implement"]; }
            set { this["implement"] = value; }
        }
    }

    public class RegistryCollection : ConfigurationElementCollection
    {
        public RegistryCollection()
        {

        }

        public override ConfigurationElementCollectionType CollectionType
        {
            get
            {
                return ConfigurationElementCollectionType.AddRemoveClearMap;
            }
        }

        protected override ConfigurationElement CreateNewElement()
        {
            return new RegistryElement();
        }

        protected override Object GetElementKey(ConfigurationElement element)
        {
            return ((RegistryElement)element).Implement;
        }

        public RegistryElement this[int index]
        {
            get
            {
                return (RegistryElement)BaseGet(index);
            }
            set
            {
                if (BaseGet(index) != null)
                {
                    BaseRemoveAt(index);
                }
                BaseAdd(index, value);
            }
        }

        new public RegistryElement this[string Name]
        {
            get
            {
                return (RegistryElement)BaseGet(Name);
            }
        }

        public int IndexOf(RegistryElement Schema)
        {
            return BaseIndexOf(Schema);
        }

        public void Add(RegistryElement Schema)
        {
            BaseAdd(Schema);
        }
        protected override void BaseAdd(ConfigurationElement element)
        {
            BaseAdd(element, false);
        }

        public void Remove(RegistryElement Schema)
        {
            if (BaseIndexOf(Schema) >= 0)
                BaseRemove(Schema.Interface);
        }

        public void RemoveAt(int index)
        {
            BaseRemoveAt(index);
        }

        public void Remove(string name)
        {
            BaseRemove(name);
        }

        public void Clear()
        {
            BaseClear();
        }
    }
    #endregion


}
